<?php
	include_once(realpath(dirname(__FILE__)) . "/../../../../fonctions/authplugins.php");

	autorisation("mailjet");

	include_once(realpath(dirname(__FILE__)) . "/../Mailjet.class.php");
?>

	    <p><a href="accueil.php" class="lien04">Accueil </a><img src="gfx/suivant.gif" width="12" height="9" border="0" /><a href="module_liste.php" class="lien04">Modules</a> <img src="gfx/suivant.gif" width="12" height="9" border="0" /><a href="module.php?nom=mailjet" class="lien04">Newsletter</a> <img src="gfx/suivant.gif" width="12" height="9" border="0" /><a href="#" class="lien04">Gestion des campagnes</a></p>

<br />

<?php

	$urlsite = new Variable();
	$urlsite->charger("urlsite");
?>

<table width="100%"  border="0" cellspacing="0" cellpadding="0">

<tr class="cellule_sombre">
  <td width="20%" height="30">&nbsp;Campagne</td>
  <td width="11%" height="30">Total</td>
  <td width="11%" height="30">Envoy&eacute;</td>
  <td width="11%" height="30">Ouvert</td>
  <td width="11%" height="30">Clic</td>
  <td width="11%" height="30">Bounce</td>
  <td width="11%" height="30">Spam</td>
</tr>

<?php
	$campagne = new Mailjet_campagne_envoi();
	
	$query_campagne = "select * from $campagne->table order by date desc";
	$resul_campagne = mysql_query($query_campagne, $campagne->link);

	$i = 0;


	while($row_campagne = mysql_fetch_object($resul_campagne)){
	
		$newsletter = new Mailjet_campagne_envoi();
		$newsletter->charger($row_campagne->campagne);
		
		$i++;
		
		if($i%2)
			$fond = "claire";
		else
			$fond = "sombre";
	
		$total = $newsletter->stat('total');
		$sent = $newsletter->stat('sent');
		$open = $newsletter->stat('open');
		$click = $newsletter->stat('click');
		$bounce = $newsletter->stat('bounce');
		$spam =	$newsletter->stat('spam');		 

?>
<tr class="cellule_<?php echo $fond; ?>">
  <td width="20%" height="30">&nbsp;<a href="<?php echo $urlsite->valeur; ?>/newsletter.php?id_dossier=<?php echo $row_campagne->id; ?>" target="_blank"><?php echo $newsletter->campagne; ?></a></td>
  <td width="12%" height="30"><?php echo $total; ?></td>
  <td width="12%" height="30"><?php echo $sent; ?> / <?php echo $sent * 100 / $total; ?>%</td>
  <td width="12%" height="30"><?php echo $open; ?> / <?php echo $open * 100 / $total; ?>%</td>
  <td width="12%" height="30"><?php echo $click; ?> / <?php echo $click * 100 / $total; ?>%</td>
  <td width="12%" height="30"><?php echo $bounce; ?> / <?php echo $bounce * 100 / $total; ?>%</td>
  <td width="12%" height="30"><?php echo $spam; ?> / <?php echo $bounce * 100 / $total; ?>%</td>
</tr>
<?php
	}
?>
</table>